﻿using System;
using System.ComponentModel;

namespace RadioButtonBindingDemo
{
    public class Model : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        private bool isToMake = true;

        public bool IsToMake
        {
            get
            {
                System.Diagnostics.Debug.WriteLine("get: " + isToMake);
                return isToMake;
            }
            set
            {
                System.Diagnostics.Debug.WriteLine("set: " + value);
                if (isToMake != value)
                {
                    isToMake = value;
                    RaisePropertyChanged("IsToMake");
                }
            }
        }

        private void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
